<template>
	<view style="background-color: #fff; padding: 20rpx 40rpx;padding-bottom: 100rpx;">
		<u-form :model="form" ref="uForm">
			<u-form-item label-width="100" label="微信号">
				<u-input v-model="form.wx_number" placeholder="请输入微信号" />
			</u-form-item>
		</u-form>
		<u-button @click="updateWxNumber()" shape="circle" :custom-style="customStyle" >修改微信号</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: '',
				form:{
					wx_number: ''
				},
				customStyle: {
					'background-color': '#962a22',
					'color': '#fff',
					'margin-bottom': '0',
					'margin-top': '80rpx',
				},
			}
		},
		onLoad({wx_number}) {
			this.form.wx_number = wx_number
		},
		methods: {
			updateWxNumber(){
				let that = this;
				uni.showLoading({
					title: '正在修改微信号'
				})
				that.$u.api.wechatInfoSave({ wx_number: that.form.wx_number}).then(res => {
					uni.$emit('updateUserInfo',{msg:'刷新用户信息'})
					
					uni.hideLoading()
					that.$u.toast('修改成功');
				})
			}
		}
	}
</script>

<style>
	body{
		background-color: #f5f5f5;
	}
</style>
